﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace INSTA.AI97.BankApp.BLL
{
    /// <summary>
    /// public base class for all account types.
    /// </summary>
    public abstract class AccountBase
    {
        private Customer        _holder;
        private double          _balance;

        /// <summary>
        /// Initializes a new instance 
        /// of the <see cref="AccountBase"/> class.
        /// </summary>
        /// <param name="holder">The holder.</param>
        /// <param name="initialDeposit">The initial deposit.</param>
        protected AccountBase(Customer holder, double initialDeposit)
        {
            // On affecte le Customer passé
            // à la propriété "Holder" (titulaire du compte).
            _holder = holder;





            // On dépose le montant initial sur 
            // le compte..
            Deposit(initialDeposit);

        }



        public abstract void WithdrawMonthlyFees();
        
        
        
        
        /// <summary>
        /// Deposits the specified amount.
        /// </summary>
        /// <param name="amount">The amount.</param>
        public void Deposit(double amount)
        {
            if (amount > 0)
            {
                _balance += amount;
            }
        }


        /// <summary>
        /// Withdraws the specified amount.
        /// </summary>
        /// <param name="amount">The amount.</param>
        public void Withdraw(double amount)
        {
            if (amount > 0)
            {
                _balance -= amount;
            }
        }




        /// <summary>
        /// Gets the balance.
        /// </summary>
        public double Balance
        {
            get { return _balance; }
        }

        /// <summary>
        /// Gets the account's holder.
        /// </summary>
        public Customer Holder
        {
            get { return _holder; }            
        }
    }
}
